<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>秒杀配置管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#name").focus();
			$("#validDays").val('${seckillConfig.validDays}');
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<shiro:hasPermission name="sys.user.edit"><li><a href="${ctx}/wechat/seckillConfig/">秒杀配置列表</a></li></shiro:hasPermission>
		<li class="active"><a href="${ctx}/wechat/seckillConfig/form?id=${seckillConfig.id}">秒杀配置<shiro:hasPermission name="wechat:seckillConfig:edit">${not empty seckillConfig.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:seckillConfig:edit">查看</shiro:lacksPermission></a></li>
		<li><a href="${ctx}/wechat/seckill/">秒杀奖品列表</a></li>
		<li><a href="${ctx}/wechat/seckill/form?id=${seckill.id}">秒杀奖品<shiro:hasPermission name="wechat:seckill:edit">${not empty seckill.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:seckill:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="seckillConfig" action="${ctx}/wechat/seckillConfig/save" method="post" class="form-horizontal"  enctype="multipart/form-data">
		<form:hidden path="id"/>
		<form:hidden path="user.id"/>
		<tags:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">名称:</label>
			<div class="controls">
				<form:input path="name" htmlEscape="false" maxlength="11" class="required"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">兑换奖品有效天数:</label>
			<div class="controls">
				<select name="validDays" id="validDays">
					<% for(int i=1;i<31;i++) {%>
					<option value="<%=i%>" ><%=i %>天</option>
					<%} %>
				</select>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">是否扣除积分:</label>
			<div class="controls">
				<input type="radio" name="cost" value="true" <c:if test="${seckillConfig.cost eq true }">  checked="checked" </c:if> /> 是   <input type="radio" name="cost" value="false" <c:if test="${seckillConfig.cost eq false }">  checked="checked" </c:if> /> 否
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">扣除积分:</label>
			<div class="controls">
				<input name="pCostScore" class="required number" type="text" htmlEscape="false" value="<fmt:formatNumber value='${seckillConfig.costScore/1000}' pattern='###.###'  minFractionDigits='3'/>">
				<label style="color:grey"><span class="alert">（元）精确到小数点后三位</span><span class="help-inline">暂时不扣分。</span></label>
				<!-- <input name="costScore" class="number"/><span class="help-inline">暂时不扣分。</span>
				<label style="color:grey"><span class="alert">积分以“<span style="color:red;">厘</span>”为单位</span></label> -->
				
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">要求最低积分:</label>
			<div class="controls">
				<input name="pMinScore" class="required number" type="text" htmlEscape="false" value="<fmt:formatNumber value='${seckillConfig.minScore/1000}' pattern='###.###'  minFractionDigits='3'/>">
				<label style="color:grey"><span class="alert">（元）精确到小数点后三位</span><span class="help-inline">会员低于此积分不能参与秒杀活动。</span></label>
				<!-- <input name="minScore" class="number"/><span class="help-inline">会员低于此积分不能参与秒杀活动。</span>
				<label style="color:grey"><span class="alert">积分以“<span style="color:red;">厘</span>”为单位</span></label> -->
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">有效果时间:</label>
			<div class="controls">
				
					<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
					<input id="startTime" name="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${seckillConfig.startTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd 00:00:00',isShowClear:false});"/>  至
					<input id="endTime" name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${seckillConfig.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
				
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">公告信息:</label>
			<div class="controls">
				<form:textarea path="notice" htmlEscape="false" rows="5" cols="10" class="required"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">Logo图片:</label>
				<div class="controls">
				<c:if test="${seckillConfig.topPic ne '' }">
					<div class="control"><img src="${ctxUser }/seckill/${seckillConfig.topPic}" style="width:300px;height:100px"/></div>
				</c:if>
				<div class="control">
					<input type="file" name="topPicFile"  />    <span class="alert">大图片建议尺寸：720像素 * 400像素;  小图片建议尺寸：400像素 * 400像素 </span>      
				</div>
			</div>
		</div>
		
		
		
		<div class="control-group">
			<label class="control-label">链接消息图片标题:</label>
			<div class="controls">
				<form:input path="seckillTitle" htmlEscape="false" maxlength="11" class=""/> <span class="alert">返回用户微信秒杀链接时的图片标题</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">链接消息显示图片:</label>
				<div class="controls">
				<c:if test="${seckillConfig.seckillPic ne '' }">
					<div class="control"><img src="${ctxUser }/seckill/${seckillConfig.seckillPic}" style="width:300px;height:100px"/></div>
				</c:if>
				<div class="control">
					<input type="file" name="seckillPicFile"  />    <span class="alert">大图片建议尺寸：720像素 * 400像素;  小图片建议尺寸：400像素 * 400像素 </span>      
				</div>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">链接消息图片描述:</label>
			<div class="controls">
				<form:textarea path="seckillDesc" htmlEscape="false" rows="3" cols="5"/> <span class="alert">返回用户微信秒杀链接时的图片描述</span>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">备注:</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="5" cols="10"   />
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="wechat:seckillConfig:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<shiro:hasPermission name="wechat:seckillConfig:edit"><a id="btnSubmit" href="${ctx}/wechat/businessNewsReply/add?type=seckill" class="btn btn-info">多图文导航</a>&nbsp;</shiro:hasPermission>
			
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>
